/*******************************************************************
 *
 * Copyright (C), 2021-2022, LS, All rights reserved.
 *
 * Author      : 
 * Create Time : 2021-09-17
 * Version     : v0.1
 * Description : 
 *******************************************************************/
 
/*----------------------------Head file----------------------------*/
#include "ls_ble_adpter.h"
#include "user_config.h"
#include "app_reset.h"
#include "flash.h"
#include "uart.h"
//#include "app_wdt.h"

/*----------------------------macro file---------------------------*/

/*----------------------------type define--------------------------*/

/*----------------------------var define---------------------------*/							

/*-------------------------func declaration------------------------*/

/*-----------------------------------------------------------------*/

void ls_ble_adpter_log_putc(uint8_t* data, uint16_t size)
{
    hal_uart_send_buff(UART0, (uint8_t*)data, size);
}


void ls_ble_adpter_platform_reset(void)
{
    app_system_reset();
}


void ls_ble_adpter_wdt_feed(void)
{
    //app_wdt_feed();
}


bool ls_ble_adpter_flash_erase_sector(const uint32_t addr)
{
    return hal_flash_erase_sector(addr);
}


uint32_t ls_ble_adpter_flash_write(const uint32_t addr, const uint8_t *buf, const uint32_t size)
{
    return hal_flash_write(addr, (uint8_t*)buf, size);
}


uint32_t ls_ble_adpter_flash_read(const uint32_t addr, uint8_t *buf, const uint32_t size)
{
    return hal_flash_read(addr, buf, size);
}


